import { ref, computed } from 'vue'
import { defineStore } from 'pinia'
import { tokenInfoApi } from '@/apis/admin'

export const useAdminStore = defineStore('admin', () => {
  const adminInfo = ref()
  const adminToken = ref()
  const setAdminInfo = (admin) => {
    adminInfo.value = admin
  }
  const getAdminInfo = () => {
    return adminInfo.value
  }
  const setTokenInfo = (token) => {
    adminToken.value = token
  }
  const getTokenInfo = () => {
    return adminToken.value
  }
  const reset = () => {
    adminInfo.value = null
    adminToken.value = null
  }
  return {
    adminToken,adminInfo,setAdminInfo,getAdminInfo,setTokenInfo,getTokenInfo,reset
  }
},
{
  persist: true,
},
)
